package com.zephyr.vchcenter.bpm.action;

import java.util.Date;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;

import com.hiaward.bpm.action.TaskAction;
import com.hiaward.bpm.context.ServiceContext;
import com.hiaward.bpm.exception.ParameterException;
import com.hiaward.bpm.exception.ServiceException;
import com.hiaward.framework.taskmanage.service.Service;
import com.zephyr.vchcenter.bean.Voucher;
import com.zephyr.vchcenter.bpm.util.RandomUtil;
import com.zephyr.vchcenter.dao.IBaseDao;
import com.zephyr.vchcenter.dao.IVoucherDao;
import com.zephyr.vchcenter.helper.SpringHelper;

/**
 * @author zhaoyunxiao
 *
 */
public class IdentifyAction extends TaskAction {
	
	private final Logger log=Logger.getLogger(IdentifyAction.class);
	
	@Override
	public void perform(ServiceContext arg0) throws ServiceException,
			ParameterException {
        
		log.debug("���进入IdentityAction............................");
		//RandomUtil randomUtil = new RandomUtil();
		String vchsid= (String)arg0.getInputParameterValue("vchsid");
		String idresult=(String)arg0.getInputParameterValue("idresult");
		String amount=(String)arg0.getInputParameterValue("amount");
		//String identifyExp = (String)arg0.getInputParameterValue("identifyExp");
		String idstate=(String)arg0.getInputParameterValue("idstate");
        IBaseDao dao=(IBaseDao)SpringHelper.getBean("baseDao");
        Voucher voucher=(Voucher)dao.findById("Voucher", vchsid);
        voucher.setIdresult(idresult);
        voucher.setIdstate(idstate);
        voucher.setAmount(amount);
	    dao.saveOrUpdate(voucher);
        Date nowTime=new Date();
        log.debug("验印结果"+idresult);
		log.debug("�离开IdentityAction......................");
	}

	@Override
	public void serviceExceptionHandle(ServiceContext arg0,
			ServiceException arg1) {

	}

}
